package com.zhentao.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 数据异常表：记录采集/入库环节的异常数据及处理情况
 * @TableName data_exception
 */
@TableName(value ="data_exception")
@Data
public class DataException implements Serializable {
    /**
     * 异常记录ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 关联采集主表ID
     */
    private Integer collectionId;

    /**
     * 异常类型：1-格式错误 2-字段缺失 3-逻辑冲突
     */
    private Integer exceptionType;

    /**
     * 异常描述
     */
    private String exceptionDesc;

    /**
     * 处理状态：1-未处理 2-已修复 3-忽略
     */
    private Integer handleStatus;

    /**
     * 处理时间
     */
    private Date handleTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        DataException other = (DataException) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getCollectionId() == null ? other.getCollectionId() == null : this.getCollectionId().equals(other.getCollectionId()))
            && (this.getExceptionType() == null ? other.getExceptionType() == null : this.getExceptionType().equals(other.getExceptionType()))
            && (this.getExceptionDesc() == null ? other.getExceptionDesc() == null : this.getExceptionDesc().equals(other.getExceptionDesc()))
            && (this.getHandleStatus() == null ? other.getHandleStatus() == null : this.getHandleStatus().equals(other.getHandleStatus()))
            && (this.getHandleTime() == null ? other.getHandleTime() == null : this.getHandleTime().equals(other.getHandleTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCollectionId() == null) ? 0 : getCollectionId().hashCode());
        result = prime * result + ((getExceptionType() == null) ? 0 : getExceptionType().hashCode());
        result = prime * result + ((getExceptionDesc() == null) ? 0 : getExceptionDesc().hashCode());
        result = prime * result + ((getHandleStatus() == null) ? 0 : getHandleStatus().hashCode());
        result = prime * result + ((getHandleTime() == null) ? 0 : getHandleTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", collectionId=").append(collectionId);
        sb.append(", exceptionType=").append(exceptionType);
        sb.append(", exceptionDesc=").append(exceptionDesc);
        sb.append(", handleStatus=").append(handleStatus);
        sb.append(", handleTime=").append(handleTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}